package com.lsqingfeng.springboot.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

import java.util.Objects;
import java.util.stream.IntStream;

/**
 * @className: WebFluxController
 * @description:
 * @author: sh.Liu
 * @date: 2022-04-01 15:09
 */
@RestController
@RequestMapping("/api/")
@Slf4j
public class WebFluxController {

    @GetMapping("hello")
    public Mono<String> hello(){
        return Mono.just("hello webflux");
    }

    @GetMapping("hello2")
    public Flux hello2(){
        return Flux.just(IntStream.range(1, 10).mapToObj(Objects::toString));
    }

}
